<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1">
    <title id="jz143120">gpstop</title>
    <body>
        <p>Stops or restarts a Greenplum Database system.</p>
        <section id="section2">
            <title>Synopsis</title>
            <codeblock>gpstop [-d &lt;master_data_directory>] [-B parallel_processes>] 
       [-M smart | fast | immediate] [-t &lt;timeout_seconds>] [-r] [-y] [-a] 
       [-l &lt;logfile_directory>] [-v | -q]

gpstop -m [-d &lt;master_data_directory>] [-y] [-l &lt;logfile_directory>] [-v | -q]

gpstop -u [-d &lt;master_data_directory>] [-l &lt;logfile_directory>] [-v | -q]
 
gpstop --host &lt;host_namea> [-d &lt;master_data_directory>] [-l &lt;logfile_directory>]
       [-t &lt;timeout_seconds>] [-a] [-v | -q]

gpstop --version 

gpstop -? | -h | --help</codeblock>
        </section>
        <section id="section3">
            <title>Description</title>
            <p>The <codeph>gpstop</codeph> utility is used to stop the database servers that
                comprise a Greenplum Database system. When you stop a Greenplum Database system, you
                are actually stopping several <codeph>postgres</codeph> database server processes at
                once (the master and all of the segment instances). The <codeph>gpstop</codeph>
                utility handles the shutdown of the individual instances. Each instance is shutdown
                in parallel. </p>
            <p>The default shutdown mode (<codeph>-M smart</codeph>) waits for current client
                connections to finish before completing the shutdown. If any connections remain open
                after the timeout period, or if you interrupt with CTRL-C, <codeph>gpstop</codeph>
                lists the open connections and prompts whether to continue waiting for connections
                to finish, or to perform a fast or immediate shutdown. The default timeout period is
                120 seconds and can be changed with the <codeph>-t
                        <varname>timeout_seconds</varname></codeph> option.</p>
            <p>Specify the <codeph>-M fast</codeph> shutdown mode to roll back all in-progress
                transactions and terminate any connections before shutting down. </p>
            <p>With the <codeph>-u</codeph> option, the utility uploads changes made to the master
                    <codeph>pg_hba.conf</codeph> file or to <i>runtime</i> configuration parameters
                in the master <codeph>postgresql.conf</codeph> file without interruption of service.
                Note that any active sessions will not pickup the changes until they reconnect to
                the database.</p>
        </section>
        <section id="section4">
            <title>Options</title>
            <parml>
                <plentry>
                    <pt>-a</pt>
                    <pd>Do not prompt the user for confirmation.</pd>
                </plentry>
                <plentry>
                    <pt>-B <varname>parallel_processes</varname></pt>
                    <pd>The number of segments to stop in parallel. If not specified, the utility
                        will start up to 64 parallel processes depending on how many segment
                        instances it needs to stop.</pd>
                </plentry>
                <plentry>
                    <pt>-d <varname>master_data_directory</varname></pt>
                    <pd>Optional. The master host data directory. If not specified, the value set
                        for <codeph>$MASTER_DATA_DIRECTORY</codeph> will be used.</pd>
                </plentry>
                <plentry>
                    <pt>--host <varname>host_name</varname></pt>
                    <pd>The utility shuts down the Greenplum Database segment instances on the
                        specified host to allow maintenance on the host. Each primary segment
                        instance on the host is shut down and the associated mirror segment instance
                        is promoted to a primary segment if the mirror segment is on another host.
                        Mirror segment instances on the host are shut down.</pd>
                    <pd>The segment instances are not shut down and the utility returns an error in
                        these cases:<ul id="ul_at2_kk3_ccb">
                            <li>Segment mirroring is not enabled for the system.</li>
                            <li>The master or standby master is on the host.</li>
                            <li>Both a primary segment instance and its mirror are on the host.</li>
                        </ul></pd>
                    <pd>This option cannot be specified with the <codeph>-m</codeph>,
                            <codeph>-r</codeph>, <codeph>-u</codeph>, or <codeph>-y</codeph>
                            options.<note>The <codeph>gprecoverseg</codeph> utility restores segment
                            instances. Run <codeph>gprecoverseg</codeph> commands to start the
                            segments as mirrors and then to return the segments to their preferred
                            role (primary segments). </note></pd>
                </plentry>
                <plentry>
                    <pt>-l <varname>logfile_directory</varname></pt>
                    <pd>The directory to write the log file. Defaults to
                            <codeph>~/gpAdminLogs</codeph>.</pd>
                </plentry>
                <plentry>
                    <pt>-m</pt>
                    <pd>Optional. Shuts down a Greenplum master instance that was started in
                        maintenance mode.</pd>
                </plentry>
                <plentry>
                    <pt>-M fast</pt>
                    <pd>Fast shut down. Any transactions in progress are interrupted and rolled
                        back.</pd>
                </plentry>
                <plentry>
                    <pt>-M immediate</pt>
                    <pd>Immediate shut down. Any transactions in progress are cancelled.</pd>
                    <pd>This mode kills all <codeph>postgres</codeph> processes without allowing the
                        database server to complete transaction processing or clean up any temporary
                        or in-process work files.</pd>
                </plentry>
                <plentry>
                    <pt>-M smart</pt>
                    <pd>Smart shut down. This is the default shutdown mode. <codeph>gpstop</codeph>
                        waits for active user connections to disconnect and then proceeds with the
                        shutdown. If any user connections remain open after the timeout period (or
                        if you interrupt by pressing CTRL-C) <codeph>gpstop</codeph> lists the open
                        user connections and prompts whether to continue waiting for connections to
                        finish, or to perform a fast or immediate shutdown.</pd>
                </plentry>
                <plentry>
                    <pt>-q</pt>
                    <pd>Run in quiet mode. Command output is not displayed on the screen, but is
                        still written to the log file.</pd>
                </plentry>
                <plentry>
                    <pt>-r</pt>
                    <pd>Restart after shutdown is complete.</pd>
                </plentry>
                <plentry>
                    <pt>-t <varname>timeout_seconds</varname></pt>
                    <pd>Specifies a timeout threshold (in seconds) to wait for a segment instance to
                        shutdown. If a segment instance does not shutdown in the specified number of
                        seconds, <codeph>gpstop</codeph> displays a message indicating that one or
                        more segments are still in the process of shutting down and that you cannot
                        restart Greenplum Database until the segment instance(s) are stopped. This
                        option is useful in situations where <codeph>gpstop</codeph> is run and
                        there are very large transactions that need to rollback. These large
                        transactions can take over a minute to rollback and surpass the default
                        timeout period of 120 seconds.</pd>
                </plentry>
                <plentry>
                    <pt>-u</pt>
                    <pd>This option reloads the <codeph>pg_hba.conf</codeph> files of the master and
                        segments and the runtime parameters of the <codeph>postgresql.conf</codeph>
                        files but does not shutdown the Greenplum Database array. Use this option to
                        make new configuration settings active after editing
                            <codeph>postgresql.conf</codeph> or <codeph>pg_hba.conf</codeph>. Note
                        that this only applies to configuration parameters that are designated as
                            <i>runtime</i> parameters.</pd>
                </plentry>
                <plentry>
                    <pt>-v</pt>
                    <pd>Displays detailed status, progress and error messages output by the
                        utility.</pd>
                </plentry>
                <plentry>
                    <pt>-y</pt>
                    <pd>Do not stop the standby master process. The default is to stop the standby
                        master.</pd>
                </plentry>
                <plentry>
                    <pt>-? | -h | --help</pt>
                    <pd>Displays the online help.</pd>
                </plentry>
                <plentry>
                    <pt>--version</pt>
                    <pd>Displays the version of this utility.</pd>
                </plentry>
            </parml>
        </section>
        <section id="section5">
            <title>Examples</title>
            <p>Stop a Greenplum Database system in smart mode:</p>
            <codeblock>gpstop</codeblock>
            <p>Stop a Greenplum Database system in fast mode:</p>
            <codeblock>gpstop -M fast</codeblock>
            <p>Stop all segment instances and then restart the system:</p>
            <codeblock>gpstop -r</codeblock>
            <p>Stop a master instance that was started in maintenance mode:</p>
            <codeblock>gpstop -m</codeblock>
            <p>Reload the <codeph>postgresql.conf</codeph> and <codeph>pg_hba.conf</codeph> files
                after making configuration changes but do not shutdown the Greenplum Database
                array:</p>
            <codeblock>gpstop -u</codeblock>
        </section>
        <section id="section6">
            <title>See Also</title>
            <p>
                <xref href="gpstart.xml#topic1">gpstart</xref>
            </p>
        </section>
    </body>
</topic>
